﻿using System.Web.Security;
using Lbb.User.Localization;

namespace Lbb.User
{
    public static class AccountValidation
    {
        public static string ErrorCodeToString(MembershipCreateStatus createStatus)
        {
            // 请参见 http://go.microsoft.com/fwlink/?LinkID=177550 以查看
            // 状态代码的完整列表。
            switch (createStatus)
            {
                case MembershipCreateStatus.DuplicateUserName:
                    return MembershipCreateStatusRes.DuplicateUserName;

                case MembershipCreateStatus.DuplicateEmail:
                    return MembershipCreateStatusRes.DuplicateEmail;

                case MembershipCreateStatus.InvalidPassword:
                    return MembershipCreateStatusRes.InvalidPassword;

                case MembershipCreateStatus.InvalidEmail:
                    return MembershipCreateStatusRes.InvalidEmail;

                case MembershipCreateStatus.InvalidAnswer:
                    return MembershipCreateStatusRes.InvalidAnswer;

                case MembershipCreateStatus.InvalidQuestion:
                    return MembershipCreateStatusRes.InvalidQuestion;

                case MembershipCreateStatus.InvalidUserName:
                    return MembershipCreateStatusRes.InvalidUserName;

                case MembershipCreateStatus.ProviderError:
                    return MembershipCreateStatusRes.ProviderError;

                case MembershipCreateStatus.UserRejected:
                    return MembershipCreateStatusRes.UserRejected;

                default:
                    return MembershipCreateStatusRes.OtherError;
            }
        }
    }
}
